/*Make sure to add
using System.Linq;
*/
string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
if(printer.Contains("jupiter"))
{
Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}
public static bool Contains(Array a, object val)
{
return Array.IndexOf(a, val) != -1;
}
//Add necessary namespace
using System.Linq;
//Example
string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"};
//using .Contains() method
if(printer.Contains("jupiter"))
{
Process.Start("BLAH BLAH CODE TO ADD PRINTER VIA WINDOWS EXEC"");
}
var array=new List<int>(1,2,3);
int count=5;
for(int i=0;i<count;i++){
if(array.Count>i){ //this is way you can check wheater
//do something //index count equals to array count
}
}